package com.xgggh.redpack;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.jakewharton.rxbinding2.support.design.widget.RxTabLayout;
import com.xgggh.app.RxBaseActivity;
import com.xgggh.binding.data.myredpack.MyRedPack;
import com.xgggh.binding.data.myredpack.Statistics;
import com.xgggh.binding.viewbinder.myredpack.StatisticsViewBinder;
import com.xgggh.redpack.databinding.ActivityMyRedPackBinding;
import com.xgggh.redpack.databinding.ActivitySponsorBinding;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import me.drakeet.multitype.Items;
import me.drakeet.multitype.MultiTypeAdapter;

/**
 * @title 我的红包 收到的红包，发出去的红包，统计数据，红包详情数据
 */
public class MyRedPackActivity extends RxBaseActivity {
    ActivityMyRedPackBinding mBinding;
    MyRedPack myRedPack = new MyRedPack();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding= DataBindingUtil.setContentView(this,R.layout.activity_my_red_pack);
        setSupportActionBar(mBinding.toolBarParent.toolbar);

        RxTabLayout.selections(mBinding.tab)
                .compose(bindToLifecycle())
                .subscribeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<TabLayout.Tab>() {
                    @Override
                    public void accept(TabLayout.Tab tab) throws Exception {
                        tab.getPosition();
                    }
                });

        Items items  = new Items();
        MultiTypeAdapter adapter  = new MultiTypeAdapter();
                adapter.register(Statistics.class,new StatisticsViewBinder());
        adapter.setItems(items);
        mBinding.contentMyRedPack.recyclerView.setAdapter(adapter);
    }





}
